package com.aaa.dem1101;

/**
 * @Author: whj
 * @Version 1.0
 * @Date: 2022/11/1  13:30
 */
public class Daemon {
    public static void main(String[] args) {
        DaemonDemo t1=new DaemonDemo();
        t1.setDaemon(true);//设置t1为守护线程---当前台线程执行完毕后，守护线程也会结束
        t1.start();

        DaemonDemo t2=new DaemonDemo();
        // t2.setDaemon(true);//设置t1为守护线程---当前台线程执行完毕后，守护线程也会结束
        t2.start();
    }
}
class DaemonDemo extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 20; i++) {
            System.out.println(Thread.currentThread().getName()+"~~~~~~~~~~"+i);
        }
    }
}
